var WXLogin = require('WXLogin');
var QQLogin = require('QQLogin');


window.LoginUtil = cc.Class({
    extends: cc.Component,

    properties: {
    },

    statics: {

        //加载网络图片
        channelLogin: function (callback) {
            var self = this;
            this.login(function (isSsuccess) { //先从微信端拉取数据
                if (isSsuccess) {
                    callback();
                }
            });

        },


        //第三方渠道登录
        login: function (back) {
            if (SystemInfo.getPlatform() == 'weChatGame') {
                WXLogin.startLogin(back);
            } else if (SystemInfo.getPlatform() == 'qqPlay') {
                QQLogin.startLogin(back);
            } else {
                back(true);
            }
        },



    }
});

module.exports = LoginUtil;